home *** CD-ROM | disk | FTP | other *** search
/ BBS in a Box 3 / BBS in a box - Trilogy III.iso / Files / Prog / B-C / C++Source Code Fmtr Folder / Tests / ChangesCode.cp next >
Encoding:
Text File  |  1991-01-15  |  1.2 KB  |  50 lines  |  [TEXT/MPS ]

  1. #if qDebug
  2. pascal void Assertion(const Boolean condition, const Str255 &description)
  3. #else
  4. pascal void Assertion(const Boolean condition, const Str255 &)
  5. #endif
  6.  
  7. {
  8.     if (!condition) {
  9. #if qDebug
  10.         GetCallersMethodName(pWho);
  11.         if (CanReadLn()) {
  12.             cout << "Assertion failed in " << pWho << ": " << description << "\n";
  13.             EnterMacAppDebugger();
  14.             if (ReadYesNo("Do you want to signal failure?"))
  15.                 Failure(minErr, 0);                /* ??? silent failure, but someday 0 messages
  16.                                                   need to be non-silent */
  17.         } else {
  18.             DebugStr("Assertion failed in " + pWho + ": " + description);
  19.             Failure(minErr, 0);                    /* ??? silent failure, but someday 0 messages
  20.                                                   need to be non-silent */
  21.         }
  22. #else
  23.         Failure(minErr, 0);                        /* ??? silent failure, but someday 0 messages
  24.                                                   need to be non-silent */
  25. #endif
  26.  
  27.     }
  28. }
  29.  
  30.  
  31. pascal void FailOSErr(short error)
  32. {
  33. #if qDebug
  34.     if (gAskFailure && (error == noErr) && CanReadLn()) {
  35.         short debugError;
  36.  
  37.         GetCallersMethodName(pWho);
  38.         debugError = ReadInteger("FailOSErr called by " + pWho + ".  Enter return error: ");
  39.         if (debugError != noErr)
  40.             Failure(debugError, 0);
  41.     }
  42. #else
  43.     if (error != noErr)
  44.         Failure(error, 0);
  45. #endif
  46. }
  47.  
  48.  
  49.  
  50.